1 /*
2 
3 Boost Software License - Version 1.0 - August 17th, 2003
4 
5 Permission is hereby granted, free of charge, to any person or organization
6 obtaining a copy of the software and accompanying documentation covered by
7 this license (the "Software") to use, reproduce, display, distribute,
8 execute, and transmit the Software, and to prepare derivative works of the
9 Software, and to permit third-parties to whom the Software is furnished to
10 do so, all subject to the following:
11 
12 The copyright notices in the Software and this entire statement, including
13 the above license grant, this restriction and the following disclaimer,
14 must be included in all copies of the Software, in whole or in part, and
15 all derivative works of the Software, unless such copies or derivative
16 works are solely in the form of machine-executable object code generated by
17 a source language processor.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
22 SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
23 FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
24 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 DEALINGS IN THE SOFTWARE.
26 
27 */ 
28 
29 module derelict.glib.gthreadpool;
30 
31 import derelict.glib.gtypes;
32 import derelict.glib.glibconfig;
33 import derelict.glib.gquark;
34 import derelict.glib.gerror;
35 
36 extern (C):
37 
38 alias _GThreadPool GThreadPool;
39 
40 struct _GThreadPool
41 {
42 	GFunc func;
43 	gpointer user_data;
44 	gboolean exclusive;
45 }
46 
47 
48 version(Derelict_Link_Static)
49 {
50     extern( C ) nothrow 
51     {
52         GThreadPool* g_thread_pool_new(GFunc func, gpointer user_data, gint max_threads, gboolean exclusive, GError** error);
53         void g_thread_pool_free(GThreadPool* pool, gboolean immediate, gboolean wait_);
54         gboolean g_thread_pool_push(GThreadPool* pool, gpointer data, GError** error);
55         guint g_thread_pool_unprocessed(GThreadPool* pool);
56         void g_thread_pool_set_sort_function(GThreadPool* pool, GCompareDataFunc func, gpointer user_data);
57         gboolean g_thread_pool_set_max_threads(GThreadPool* pool, gint max_threads, GError** error);
58         gint g_thread_pool_get_max_threads(GThreadPool* pool);
59         guint g_thread_pool_get_num_threads(GThreadPool* pool);
60         void g_thread_pool_set_max_unused_threads(gint max_threads);
61         gint g_thread_pool_get_max_unused_threads();
62         guint g_thread_pool_get_num_unused_threads();
63         void g_thread_pool_stop_unused_threads();
64         void g_thread_pool_set_max_idle_time(guint interval);
65         guint g_thread_pool_get_max_idle_time();
66     }
67 }
68 else
69 {
70     extern( C ) nothrow 
71     {
72         alias da_g_thread_pool_new = GThreadPool* function(GFunc func, gpointer user_data, gint max_threads, gboolean exclusive, GError** error);	
73         alias da_g_thread_pool_free = void function(GThreadPool* pool, gboolean immediate, gboolean wait_);											
74         alias da_g_thread_pool_push = gboolean function(GThreadPool* pool, gpointer data, GError** error);											
75         alias da_g_thread_pool_unprocessed = guint function(GThreadPool* pool);																		
76         alias da_g_thread_pool_set_sort_function = void function(GThreadPool* pool, GCompareDataFunc func, gpointer user_data);						
77         alias da_g_thread_pool_set_max_threads = gboolean function(GThreadPool* pool, gint max_threads, GError** error);							
78         alias da_g_thread_pool_get_max_threads = gint function(GThreadPool* pool);																	
79         alias da_g_thread_pool_get_num_threads = guint function(GThreadPool* pool);																	
80         alias da_g_thread_pool_set_max_unused_threads = void function(gint max_threads);															
81         alias da_g_thread_pool_get_max_unused_threads = gint function();																			
82         alias da_g_thread_pool_get_num_unused_threads = guint function();																			
83         alias da_g_thread_pool_stop_unused_threads = void function();																				
84         alias da_g_thread_pool_set_max_idle_time = void function(guint interval);																	
85         alias da_g_thread_pool_get_max_idle_time = guint function();	
86     }
87 
88     __gshared
89     {
90         da_g_thread_pool_new g_thread_pool_new; 
91         da_g_thread_pool_free g_thread_pool_free; 
92         da_g_thread_pool_push g_thread_pool_push; 
93         da_g_thread_pool_unprocessed g_thread_pool_unprocessed; 
94         da_g_thread_pool_set_sort_function g_thread_pool_set_sort_function; 
95         da_g_thread_pool_set_max_threads g_thread_pool_set_max_threads; 
96         da_g_thread_pool_get_max_threads g_thread_pool_get_max_threads; 
97         da_g_thread_pool_get_num_threads g_thread_pool_get_num_threads; 
98         da_g_thread_pool_set_max_unused_threads g_thread_pool_set_max_unused_threads; 
99         da_g_thread_pool_get_max_unused_threads g_thread_pool_get_max_unused_threads; 
100         da_g_thread_pool_get_num_unused_threads g_thread_pool_get_num_unused_threads; 
101         da_g_thread_pool_stop_unused_threads g_thread_pool_stop_unused_threads; 
102         da_g_thread_pool_set_max_idle_time g_thread_pool_set_max_idle_time; 
103         da_g_thread_pool_get_max_idle_time g_thread_pool_get_max_idle_time; 
104     }
105 }